﻿using System;

namespace YourLastOptionsDialog.ViewModels.Options
{
    /// <summary>
    /// An option that represents a <see cref="TimeSpan" /> value.
    /// </summary>
    public class TimeSpanOption : Option
    {
        private TimeSpan _maximum;

        private TimeSpan _step;

        /// <summary>
        /// Gets or sets the <see cref="TimeSpan" /> value of the wrapped underlying source.
        /// </summary>
        public TimeSpan Value
        {
            get
            {
                return (TimeSpan)GetAccessor();
            }

            set
            {
                SetAccessor(value);
                RaisePropertyChanged("Value");
            }
        }

        /// <summary>
        /// Gets or sets the maximum value allowed.
        /// </summary>
        public TimeSpan Maximum
        {
            get
            {
                return _maximum;
            }

            set
            {
                if (_maximum != value)
                {
                    _maximum = value;
                    RaisePropertyChanged("Maximum");
                }
            }
        }

        /// <summary>
        /// Gets or sets the step used in the UI for the selector.
        /// </summary>
        public TimeSpan Step
        {
            get
            {
                return _step;
            }

            set
            {
                if (_step != value)
                {
                    _step = value;
                    RaisePropertyChanged("Step");
                }
            }
        }
    }
}